import { loadEnv } from 'vite';

const env = loadEnv(process.env.NODE_ENV as string, process.cwd())
const _base_url = env.VITE_APP_BASE_API;

export default {
  server: {
    host: "0.0.0.0",
    port: 8080,
    open: true,
    cors: true,
    proxy: {
      [`^${_base_url}`]: {
        target: 'http://192.168.9.83:8080',
        changeOrigin: true,
        rewrite: (p: string) => p.replace(new RegExp(`^${_base_url}`), '')
      },
    },
    hmr: { // 热更新配置
      overlay: true, // 显示错误覆盖层
    },
  },
};
